package com.ss.android.download;

import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.telephony.TelephonyManager;
import android.util.Log;

final class p implements t {
    private Context a;
    private static p b;

    private p(Context arg2) {

        this.a = arg2.getApplicationContext();
    }

    public synchronized static p a(Context arg2) {
        if (p.b == null) {
            p.b = new p(arg2);
        }

        return p.b;
    }

    public final long a() {
        return System.currentTimeMillis();
    }

    public final void a(Intent arg3) {
        try {
            arg3.setClass(this.a, DownloadHandlerService.class);
            this.a.startService(arg3);
        } catch (Exception v0) {
        }
    }

    public final NetworkInfo b() {
        NetworkInfo v0_1;
        Object v0 = this.a.getSystemService(Context.CONNECTIVITY_SERVICE);
        if (v0 == null) {
            Log.w("SsDownloadManager", "couldn\'t get connectivity manager");
            v0_1 = null;
        } else {
            v0_1 = ((ConnectivityManager) v0).getActiveNetworkInfo();
            if (v0_1 == null && (com.ss.android.download.aa.d)) {
                Log.v("SsDownloadManager", "network is not available");
            }
        }

        return v0_1;
    }

    public final boolean c() {
        boolean v2 = true;
        boolean v3 = false;
        Object v0 = this.a.getSystemService(Context.CONNECTIVITY_SERVICE);
        if (v0 == null) {
            Log.w("SsDownloadManager", "couldn\'t get connectivity manager");
        } else {
            NetworkInfo v0_1 = ((ConnectivityManager) v0).getActiveNetworkInfo();
            int v1 = v0_1 == null || v0_1.getType() != 0 ? 0 : 1;
            v0 = this.a.getSystemService(Context.TELEPHONY_SERVICE);
            if (v1 == 0 || !((TelephonyManager) v0).isNetworkRoaming()) {
                v2 = false;
            }

            if ((com.ss.android.download.aa.d) && (v2)) {
                Log.v("SsDownloadManager", "network is roaming");
            }

            v3 = v2;
        }

        return v3;
    }

    public final Long d() {
        return e.a();
    }

    public final Long e() {
        return e.b();
    }
}

